package com.action.gulimall.ware.dao;

import com.action.common.to.SkuStockTo;
import com.action.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 * 
 * @author shilun
 * @email shilun217@qq.com
 * @date 2021-06-09 23:17:11
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addStock(@Param(value="skuId") Long skuId,@Param(value="wareId") Long wareId,@Param(value="skuNum") Integer skuNum);

    Long skuIdStock(@Param(value="skuId") Long skuId);

    Long getSkuStock(@Param("item") Long item);

    Map<Long,Long> getSkuStockMap(@Param("item") Long item);


    Long lockSkuStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    void releaseLockedStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);
}
